<!doctype html>
<html>
<head>
	<title>^js-42-田作业</title>
	<meta charset="UTF-8"/>
	<style>
	
	*{
		margin:0;
		padding:0;
	}
		a{
			text-decoration:none;/*去掉a标签超链接的下划线*/
		}
		ul li{
			list-style:none;/*去掉ul列表前面的点*/
		}
	div{
		width:300px;
		height:80px;
		border:1px dashed;
		margin:50px auto;
	}
		p{
			width:100%;
			height:80px;
			line-height:80px;
			font-size:12px;
			text-align:center;
		}
		span{
			line-height:80px;
			color:red;
		}
	</style>
</head>
<body>
	<div>

		<p>
			页面未找到将在 <span> 5 </span> 秒后跳转到百度！
		</p>
	</div>
</body>

	<script>
		var oSpan=document.querySelector("span");

        var shu=5;
			// alert(oSpan.length);
			var cl=setInterval(function (){
                shu--;
                if(shu<=0){
                    clearInterval(cl);//关闭动画
                    window.open(url="https://www.baidu.com/",target="_self");
				}//在当前窗口跳转到百度页面，
                oSpan.innerHTML=shu;
                console.log(shu);

            },1000);


	</script>
</html>